#include <stdlib.h>
#include <uuid/uuid.h>

#define NIT_SHORT_NAMES
#include <nit/macros.h>
#include <nit/palloc.h>
#include <nit/list.h>

#include "des.h"
#include "cell.h"
#include "pur.h"

Inb_pur *
inb_pur_new(uuid_t id, Inb_cell *sub)
{
	Inb_pur *pur;
	Inb_des *des = inb_palloc(pur);

	pcheck(pur, NULL);
	des->type = PUR;
	des->flags = INB_FREE;
	pur = inb_thing(des);

	if (id)
		uuid_copy(pur->id, id);
	else
		uuid_generate(pur->id);

	pur->sub = sub;
	return pur;
}
